package com.example.ximalaya.adapters;

import android.util.Log;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.example.ximalaya.utils.FragmentCreator;
/*
Fragment和ViewPager适配器
 */
public class MainContentAdapter extends FragmentPagerAdapter {


    public MainContentAdapter(@NonNull  FragmentManager fm) {
        super(fm);
    }

    //返回Fragment
    @Override
    public Fragment getItem(int position) {
        //调用静态方法
        return FragmentCreator.getFragment(position);
    }

    //返回Pager的个数
    @Override
    public int getCount() {
        return FragmentCreator.PAGE_COUNT;
    }
}
